/*
 * Copyright 2014 by État de Genève (Switzerland)
 * All rights reserved.
 *
 * Author: ELCA Informatique SA
 */
define(['services/user'], function(user) {
    var FormEditButton = function() {

        this.currentUser = user.initials;

    };

    FormEditButton.prototype.save = save;
    FormEditButton.prototype.lock = lock;
    FormEditButton.prototype.releaseLock = releaseLock;
    FormEditButton.prototype.activate = viewActivate;

    return FormEditButton;

    function save() {
        if(this.saveCallback) {
            this.saveCallback();
        }
    }

    function lock() {
        if(this.editCallback) {
            this.editCallback();
        }
    }

    function releaseLock() {
        if(this.releaseLockCallback) {
            this.releaseLockCallback();
        }
    }

    function viewActivate(settings) {

        this.saveCallback = settings.save;
        this.releaseLockCallback = settings.cancel;
        this.editCallback = settings.edit;

    }
});